package jframe.entity.bean;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.compass.annotations.Index;
import org.compass.annotations.Searchable;
import org.compass.annotations.SearchableComponent;
import org.compass.annotations.SearchableProperty;
import org.compass.annotations.Store;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import jframe.entity.base.EntityBase;


/**
 * @描述:<p>用户 </p>
 * 
 * @作者: 叶平平(yepp)
 * 
 * @时间: 2011-6-19 下午12:47:26
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "sys_user")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Searchable(root = true)
public class User extends EntityBase {
	
	/**
	 * 用户名称
	 * store是否存储; boost:优先级
	 */
	@Column(name="userName", nullable=true,length=50,columnDefinition="varchar(50)")
	@SearchableProperty(name="userName",store=Store.YES,boost=1)
	private String userName;
	/**
	 * 用户密码
	 * index:是否索引; store是否存储; boost:优先级
	 */
	@Column(name="passWord", nullable=true,length=50,columnDefinition="varchar(200)")
	@SearchableProperty(name="passWord",index=Index.NO,store=Store.YES,boost=1)
	private String passWord;
	
	/**
	 * 用户详细信息
	 * optional=true,optional声明关系是否是必须存在的,即是否允许其中一端为null
	 */
	@OneToOne(cascade={CascadeType.ALL},fetch=FetchType.LAZY,optional=true,targetEntity=UserInfo.class)
	@JoinColumn(name="userInfoIds",columnDefinition="bigint(20)",unique=true,nullable=true)
	@SearchableComponent
	private UserInfo userInfo;
	
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public String getPassWord() {
		return passWord;
	}
	public void setPassWord(String passWord) {
		this.passWord = passWord;
	}
	public UserInfo getUserInfo() {
		return userInfo;
	}
	public void setUserInfo(UserInfo userInfo) {
		this.userInfo = userInfo;
	}
	
}
